package com.itdfq.springboot_swagger.controller;

import com.itdfq.springboot_swagger.pojo.Users;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * @Author GocChin
 * @Date 2021/6/7 18:19
 * @Blog: itdfq.com
 * @QQ: 909256107
 * @Descript:
 */
@ApiOperation("hello控制类")
@RestController
public class DemoController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }
    //接口中返回中存在实体类，就可以被访问到
    @RequestMapping("/user")
    public Users users(){
        return new Users();
    }

    @GetMapping(value = "/add")
    public Users users(@ApiParam(value = "用户名",required = false) String username){
        Users users = new Users();
        users.setUsername(username);
        return users;
    }
}
